package androidx.gdata.spreadsheets;

import androidx.gdata.Author;
import androidx.gdata.LinkUrl;
import androidx.gdata.OpenSearch;
import androidx.gdata.ThingWithLinks;

import java.io.Serializable;

public class ListCollection extends ThingWithLinks implements Serializable {
  
  private String id;
  private String updated;
  private String title;
  private Author author;
  private ListEntry[] entries;
  private static final String POST_URL =
    "http://schemas.google.com/g/2005#post";

  public ListCollection(String id, String updated, String title, LinkUrl[] links,
      Author author, ListEntry[] entries) {
    super(links);
    this.id = id;
    this.updated = updated;
    this.title = title;
    this.author = author;
    this.entries = entries;
  }
  
  public ListEntry[] getEntries() {
    return entries;
  }

  public String getPostUrl() {
    for (LinkUrl linkUrl : getLinks()) {
      if (linkUrl.getRel().equals(POST_URL)) {
        return linkUrl.getHref();
      }
    }
    return null;
  }

}
